home *** CD-ROM | disk | FTP | other *** search
-
- if {[string compare test [info procs test]] == 1} then \
- {source defs}
-
- # set VERBOSE 1
-
- proc arrowSize {} {
- .arrow getValues \
- -unitType t \
- -width w \
- -height h
- return "$t $w $h"
- }
-
- proc setDirection {dir} {
- .arrow setValues -arrowDirection $dir
- .arrow getValues -arrowDirection d
- return $d
- }
-
- xtAppInitialize -class Arrow
- . setValues -allowShellResize true
-
- xmArrowButton .arrow managed \
- -width 100 -height 100
-
- . realizeWidget
-
- ##################
- # Arrow Directions
- ##################
-
- if {$XmVersion >= 1002} {
- test arrow-1.1 {arrow direction down} {
- setDirection arrow_down
- } {arrow_down}
-
- test arrow-1.2 {arrow direction left} {
- setDirection arrow_left
- } {arrow_left}
-
- test arrow-1.3 {arrow direction right} {
- setDirection arrow_right
- } {arrow_right}
-
- test arrow-1.4 {arrow direction up} {
- setDirection arrow_up
- } {arrow_up}
- }
-
- #############################
- # setup for arrow callbacks #
- #############################
-
- proc armCB {} {
- return "...armed"
- }
-
- proc activateCB {} {
- return "...activated"
- }
-
- proc disarmCB {} {
- return "...disarmed"
- }
-
- .arrow armCallback armCB
- .arrow activateCallback activateCB
- .arrow disarmCallback disarmCB
-
- #################
- # Arrow callbacks
- #################
-
- test arrow-2.1 {arrow arm} {
- .arrow callActionProc Arm()
- } {...armed}
-
- # activate assumes it comes from a ButtonPress.
- # coords within its boundaries mean ButtonRelease
- # occurs within the widget, so activate callback occurs.
- # outside this, no callback is invoked
-
- # this one is inside boundary
- test arrow-2.2 {arrow activate } {
- .arrow callActionProc Activate() \
- -type ButtonPress \
- -x 0 -y 0
- } {...activated}
-
- test arrow-2.3 {arrow disarm} {
- .arrow callActionProc Disarm()
- } {...disarmed}
-
- test arrow-2.3 {arrow armAndActivate} {
- .arrow callActionProc ArmAndActivate()
- } {...armed...activated...disarmed}
-
- .arrow destroyWidget
-
- ###################################
- # setup arrow for % substitutions #
- ###################################
-
- proc armCB {w} {
- return $w
- }
-
- xmArrowButton .arrow2 managed
- .arrow2 armCallback {armCB %w}
-
- ##################
- # %w substitiution
- ##################
- test arrow-3.1 {%w substitution} {
- .arrow2 callActionProc Arm()
- } {.arrow2}
-
- .arrow2 destroyWidget
-
- # we don't want to go into interactivity:
- # . mainLoop
-
-
-